*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		TABLES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/


*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** Table A7
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	
	
use data/processed/data_1, clear 

global controls ln_hhnetinc hhnetinc19_NR ///
	ln_ofinwealth_lvl ln_retirewealth_lvl ///
	ln_realestate_lvl realestJan20_NR ///
	ln_debt_lvl  debtJan20_NR ///
	stockinvestor riskshare_finwealth_Jan201 stockexperience ///
	i.agecat male married separated_divorced widowed ///	
	highschool some_college_associate_degree atleast_bachelor  ///
	z_decisionmaker mainearner_alone self_empl retired unempl empl_other z_constrained ///
	republican other_party NR_party  ///
	i.region ///
	i.svydate

loc experiments "recovery_duration z_manip1 z_manip2 z_manip3 exp_ret_mean exp_ret_sd retdist_neg30 retdist_pos30"

preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {
reg `choice' prior $controls, r, if arm_fincrisis==1 & treated==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar prior , prec(3)
estadd loc thisstat3 = "`r(bstar)'": col`colnum'
estadd loc thisstat4 = "`r(sestar)'": col`colnum'

estadd loc thisstat6 = `N': col`colnum'

reg `choice' prior $controls, r, if arm_dotcom==1 & treated==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar prior , prec(3)
estadd loc thisstat10 = "`r(bstar)'": col`colnum'
estadd loc thisstat11 = "`r(sestar)'": col`colnum'

estadd loc thisstat13 = `N': col`colnum'

reg `choice' prior $controls, r, if arm_black==1 & treated==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar prior , prec(3)
estadd loc thisstat17 = "`r(bstar)'": col`colnum'
estadd loc thisstat18 = "`r(sestar)'": col`colnum'

estadd loc thisstat20 = `N': col`colnum'


estadd loc thisstat22 "Yes": col`colnum'
*estadd loc thisstat36= `r2': col`colnum'
*estadd loc thisstat37 = `N': col`colnum'



loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"

}

loc rowlabels " "{\bf Panel A: Fin Crisis}" " " "Prior recovery duration" "Fin. Crisis 2007" " " "Observations" " " "\hline {\bf Panel B: Dot-com}" " " "Prior recovery duration" "Dot-com 2000" " " "Observations" " " "\hline {\bf Panel C: Black Monday}" " " "Prior recovery duration" "Black Monday 1987" " " "Observations" " " "\hline Individual controls" " 


forval i = 1/22 {
    loc rowstats "`rowstats' thisstat`i'"
}

esttab * using "Tables/TableA7.tex", replace cells(none) booktabs nonotes nomtitles compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
     mgroups("\shortstack{Stock\\recovery\\duration}" "\shortstack{Agree:\\Recovery\\many yrs.}" "\shortstack{Agree:\\Set back\\many yrs.}" "\shortstack{Agree:\\Recover\\2020}" ///
 "\shortstack{Stock\\return:\\Mean}" "\shortstack{Stock\\return:\\SD}" "\shortstack{Stock \\ return \\ <-30\%}" "\shortstack{Stock \\ return \\ >30\%}" , pattern(1 1 1 1 1 1 1 1  ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))


